Skip to content

Optimization for prover (override #1774)#1783

Open
noel2004 wants to merge 32 commits intodevelopfrom
feat/zkvm_prover_143
Open

Optimization for prover (override #1774)#1783
noel2004 wants to merge 32 commits intodevelopfrom
feat/zkvm_prover_143

Conversation

@noel2004
Copy link
Member

@noel2004 noel2004 commented Jan 16, 2026

This PR purpose a stable version for prover after GalileoV2 forking.
This PR would replace #1774

Current status:

  • depending on zkvm-prover with openvm 1.4.3
  • drop the compatibility for guest built from openvm-1.3, performance gain from ~0.2MHz -> 0.7MHz (proving speed)
  • exit process while proving process panic to avoid a not-working prover lingers
  • add dump mode to dump a dep-free format for testing in bare openvm prover
  • 02/03/26: include urgent fixing for bn254 vulnerability and metered execution
  • support validium update (feat: adjustments for launching Cloak with GalileoV2 #1793)

Summary by CodeRabbit

  • New Features

    • Added task dumping (JSON/binary), CLI Dump command, and local debug mode for asset handling.
  • Refactor

    • Removed legacy witness encoding and simplified serialization; consolidated import paths; increased segment size.
  • Tests

    • Added Galileo and cloak-galileoV2 test environments and configs; removed Sepolia Feynman test data.
  • Chores

    • Version bumped to v4.7.12 and updated several dependency versions.

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Removes legacy witness encoding, refactors scroll-related import paths, adds a CLI "dump" feature that writes ProvingTask data to disk, updates prover asset/handler signatures, bumps workspace and Go module dependencies, and adds/updates multiple prover-e2e test configurations for Galileo variants.

Changes

Cohort / File(s) Summary
Workspace & Version bumps
Cargo.toml, common/version/version.go, crates/prover-bin/Cargo.toml, bridge-history-api/go.mod, common/go.mod, coordinator/go.mod, rollup/go.mod, tests/integration-test/go.mod, tests/prover-e2e/Makefile
Bump package/version to v4.7.12; pin scroll-zkvm-* workspace deps to specific git revs; add bincode to prover-bin; bump github.com/scroll-tech/da-codec in multiple go.mod files; forward SCROLL_ZKVM_VERSION in test Makefile.
Legacy witness removal & imports
crates/libzkp/src/lib.rs, crates/libzkp/src/proofs.rs, crates/libzkp/src/tasks/batch.rs, crates/libzkp/src/tasks/bundle.rs, crates/libzkp/src/tasks/chunk.rs
Remove legacy witness-mode support and related API/flag (witness_use_legacy_mode, legacy_witness_encoding field); eliminate legacy serialization branches; consolidate imports to nested scroll::... module paths; update BundleInfo pi-hash API usage to versioned call.
Prover dump feature
crates/prover-bin/src/dumper.rs, crates/prover-bin/src/main.rs
Add Dumper ProvingService adapter that serializes/dumps ProvingTask to JSON or binary (bincode); introduce Dump CLI command and TaskType enum; wire dumper into ProverBuilder one-shot flow.
Prover / circuits handler changes
crates/prover-bin/src/prover.rs, crates/prover-bin/src/zk_circuits_handler/universal.rs
Add debug_mode to AssetsLocationData; remove is_openvm_v13 parameter from UniversalHandler::new and creation sites; increase circuit segment_len and adjust panic/failed task handling.
E2E test config & genesis updates
tests/prover-e2e/.../config*.json, tests/prover-e2e/*/.make.env, tests/prover-e2e/*/genesis.json, tests/prover-e2e/sepolia-feynman/00100_import_blocks.sql
Add Galileo and GalileoV2 test fixtures and configs, update codec_version and verifiers assets/fork names, add/remove various .make.envs and genesis files, remove bulk SQL inserts for sepolia-feynman.
Validium / codec logic & utils
coordinator/internal/utils/codec_validium.go, coordinator/internal/utils/version.go, rollup/cmd/rollup_relayer/app/app.go, rollup/internal/controller/relayer/l2_relayer.go, rollup/internal/utils/utils.go
Adjust error text, enforce codec version >= v10 when ValidiumMode, add explicit validium fork validation, remove temporary genesis-state-root workaround and update related comments.
Misc test / scaffolding edits
tests/prover-e2e/cloak-*/*, tests/prover-e2e/sepolia-*/*, tests/prover-e2e/mainnet-galileo/*
Add/remove various test env files and configs for cloak and sepolia/mainnet variants; add fetch_config and codec updates for mainnet-galileo and cloak-galileoV2.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI (main.rs)
  participant Prover as ProverBuilder/OneShot
  participant Dumper as Dumper (ProvingService)
  participant FS as FileSystem
  CLI->>Prover: invoke one_shot(task_id, task_type, dump_config)
  Prover->>Dumper: prove(ProvingTask)
  Dumper->>FS: write input_task.json or input_task.bin, agg_proofs.bin
  FS-->>Dumper: write OK / error
  Dumper-->>Prover: ProveResponse (Failed with optional message)
  Prover-->>CLI: return exit status
Loading

(Note: colored rectangles not required for this simple flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested labels

bump-version

Suggested reviewers

  • lispc
  • Thegaram
  • jonastheis

Poem

🐰
I nibble bytes and forked trees,
I dump the tasks beneath the breeze,
Legacy dust left on the floor,
New proofs hop to newer shore,
Version bumped — hop, hop, encore!

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Optimization for prover (override #1774)' is partially related to the changeset but lacks specificity about the main optimizations and does not follow conventional commits format. Update title to follow conventional commits (e.g., 'perf: upgrade zkvm-prover to openvm 1.4.3 and drop openvm-1.3 support') to clearly indicate the performance improvement focus and key change.
Description check ⚠️ Warning The PR description explains the purpose and key changes, but does not follow the required template structure with explicit checkboxes for conventional commits type, versioning, and breaking change labels. Complete the PR template by selecting appropriate checkboxes for conventional commits type (perf), confirming version bump (v4.7.12), and breaking change status; provide structured answers to all required template questions.
Docstring Coverage ⚠️ Warning Docstring coverage is 19.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/zkvm_prover_143

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@Cargo.toml`:
- Around line 17-23: Update the inline comment that currently reads "with openvm
1.4.2" to "with openvm 1.4.3" in the Cargo.toml workspace.dependencies block so
the comment matches the actual OpenVM version recorded in Cargo.lock; locate the
comment near the scroll-zkvm-prover/scroll-zkvm-verifier/scroll-zkvm-types
entries and change only the version number in that comment.

In `@crates/prover-bin/src/dumper.rs`:
- Around line 13-16: The Dumper struct's target_path is currently ignored by
dump(); update the Dumper::dump (and any related methods around lines 24-39) to
use the Dumper.target_path when creating/writing the output file: convert
target_path to a Path/PathBuf, ensure the parent directory exists
(create_dir_all if needed), join the intended filename to that path instead of
using the current working directory, and open/create the file at that joined
path for writing; also preserve existing json_mode logic and error handling when
writing to the computed target path.

In `@crates/prover-bin/src/main.rs`:
- Around line 60-61: Change the clap argument for the json flag to use
flag-style parsing by replacing the current default_value usage with action =
ArgAction::SetTrue for the json_mode field; locate the json_mode field
declaration in main.rs (the #[arg(long = "json", default_value = "false")]
json_mode: bool,) and update it to use #[arg(long = "json", action =
ArgAction::SetTrue)] json_mode: bool, and ensure ArgAction is in scope (same
pattern used by the version flag in this file).
- Around line 95-108: The Dump command currently calls
ProverBuilder::new(...).build().await and then ignores the boolean/result of
Arc::new(prover).one_shot(&[task_id], task_type.into()).await; modify the Dump
command path to check the returned Result/bool from one_shot (same as the Handle
path does), and if it indicates failure return or propagate an error to the CLI
(e.g., map_err/eyre::eyre! or bail). Locate the call site for one_shot in
main.rs and ensure you mirror the Handle flow: inspect the awaited value,
convert it to a useful error on failure, and propagate it up instead of
discarding it.

In `@tests/prover-e2e/mainnet-galileo/genesis.json`:
- Around line 23-25: The fork-time keys use inconsistent casing: change the
object keys "GalileoTime" and "GalileoV2Time" to lowerCamelCase "galileoTime"
and "galileoV2Time" so they match the rest of the fork-time fields (e.g.,
"feynmanTime", "darwinTime") and the JSON unmarshal expectation; update the keys
in the genesis JSON where "GalileoTime" and "GalileoV2Time" appear (replace with
"galileoTime" and "galileoV2Time") to restore correct fork activation parsing.
🧹 Nitpick comments (2)
tests/prover-e2e/mainnet-galileo/config.json (1)

8-11: Make the RPC endpoint configurable to improve E2E stability.

The hardcoded https://mainnet-rpc.scroll.io endpoint lacks override mechanisms (no env vars, no CLI flags, no template substitution). E2E tests become brittle against rate limits and service outages. Consider adding environment variable support or command-line override for fetch_config.endpoint so tests can point to controlled or local RPC nodes during CI and local development.

crates/prover-bin/src/prover.rs (1)

33-35: Debug-mode skip is OK; consider clearer operator signal.

Default false keeps compatibility, but in debug mode stale/corrupt local files may be used. Consider logging the full local path (or a warning) to make this obvious in logs.

Also applies to: 85-91

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efca370 and 6a57a2e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (18)
  • Cargo.toml
  • crates/libzkp/src/lib.rs
  • crates/libzkp/src/proofs.rs
  • crates/libzkp/src/tasks/batch.rs
  • crates/libzkp/src/tasks/bundle.rs
  • crates/libzkp/src/tasks/chunk.rs
  • crates/prover-bin/Cargo.toml
  • crates/prover-bin/src/dumper.rs
  • crates/prover-bin/src/main.rs
  • crates/prover-bin/src/prover.rs
  • crates/prover-bin/src/zk_circuits_handler/universal.rs
  • tests/prover-e2e/mainnet-galileo/.make.env
  • tests/prover-e2e/mainnet-galileo/config.json
  • tests/prover-e2e/mainnet-galileo/config.template.json
  • tests/prover-e2e/mainnet-galileo/genesis.json
  • tests/prover-e2e/sepolia-feynman/.make.env
  • tests/prover-e2e/sepolia-feynman/00100_import_blocks.sql
  • tests/prover-e2e/sepolia-feynman/genesis.json
💤 Files with no reviewable changes (3)
  • tests/prover-e2e/sepolia-feynman/.make.env
  • tests/prover-e2e/sepolia-feynman/00100_import_blocks.sql
  • tests/prover-e2e/sepolia-feynman/genesis.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-16T02:09:51.657Z
Learnt from: noel2004
Repo: scroll-tech/scroll PR: 1736
File: crates/libzkp/src/verifier/universal.rs:35-45
Timestamp: 2025-09-16T02:09:51.657Z
Learning: The verify_stark_proof method in scroll-zkvm-verifier returns Result<(), Error> indicating success/failure, not Result<bool, Error>. When it succeeds, verification passed; when it fails, it returns an error.

Applied to files:

  • crates/libzkp/src/tasks/batch.rs
  • crates/libzkp/src/proofs.rs
  • crates/libzkp/src/tasks/bundle.rs
🧬 Code graph analysis (6)
crates/libzkp/src/tasks/batch.rs (1)
crates/libzkp/src/tasks.rs (1)
  • encode_task_to_witness (19-22)
crates/libzkp/src/tasks/chunk.rs (1)
crates/libzkp/src/tasks.rs (1)
  • encode_task_to_witness (19-22)
crates/prover-bin/src/prover.rs (4)
crates/prover-bin/src/types.rs (2)
  • default (62-64)
  • default (105-107)
crates/libzkp/src/lib.rs (1)
  • new (24-40)
crates/prover-bin/src/zk_circuits_handler/universal.rs (1)
  • new (19-31)
crates/libzkp/src/tasks.rs (1)
  • new (53-58)
crates/prover-bin/src/main.rs (1)
common/types/message/message.go (1)
  • ProofType (14-14)
crates/libzkp/src/proofs.rs (4)
coordinator/internal/types/block.go (1)
  • BatchInfo (4-8)
common/types/message/message.go (1)
  • ChunkInfo (131-148)
common/version/version.go (1)
  • Version (31-31)
coordinator/internal/utils/version.go (1)
  • Version (16-42)
crates/libzkp/src/tasks/bundle.rs (1)
crates/libzkp/src/tasks.rs (1)
  • encode_task_to_witness (19-22)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: tests
🔇 Additional comments (19)
crates/libzkp/src/tasks/chunk.rs (2)

4-8: LGTM: updated chunk import path.

Aligns with the new scroll::chunk module layout and keeps types centralized.


117-126: LGTM: unified witness serialization.

Using encode_task_to_witness here keeps serialization consistent across tasks.

crates/libzkp/src/tasks/batch.rs (2)

4-13: LGTM: batch/chunk imports reorganized.

Keeps batch and chunk types under the unified scroll module structure.


119-133: LGTM: consolidated witness encoding path.

Consistent use of encode_task_to_witness improves maintainability.

crates/libzkp/src/tasks/bundle.rs (2)

3-7: LGTM: bundle imports aligned with new module layout.


27-40: LGTM: standardized witness serialization.

crates/libzkp/src/proofs.rs (3)

6-13: Import reorganization looks good.

The migration from flat paths to nested scroll::{...} module paths aligns with the broader codebase refactoring. The types (BatchInfo, BundleInfo, ChunkInfo) are used consistently throughout the file.


216-216: Test import update is consistent.

The test import aligns with the new scroll::bundle::BundleInfo path used in the main imports.


254-254: Versioned API approach is more flexible.

Using pi_hash_by_version(version::Version::euclid_v1()) instead of a specific pi_hash_euclidv1() method is a cleaner pattern that allows the same API to handle multiple protocol versions. This is consistent with the pi_hash_check method on line 181 that takes version::Version as a parameter, and the pattern is used consistently across the codebase (chunk.rs, bundle.rs, batch.rs).

tests/prover-e2e/mainnet-galileo/config.template.json (1)

13-15: LGTM — template now aligned with Galileo fork settings.

Also applies to: 27-27

tests/prover-e2e/mainnet-galileo/.make.env (1)

1-3: Confirm blocks 26653680–26653686 fall within the Galileo fork activation window.

The block range is consumed inclusively (7 blocks total) from the official Scroll mainnet RPC. Verify that these block numbers correspond to the Galileo fork epoch by checking against Scroll's fork activation documentation or querying actual block timestamps; otherwise, the E2E test coverage may be misleading or flaky if blocks predate the fork activation.

crates/prover-bin/Cargo.toml (1)

12-12: Verify dependency pins for scroll-proving-sdk and bincode 2.0.

Please confirm the git rev 22ad34e is the intended commit and that bincode 2.0 with serde is compatible with the new dumper serialization path.

Also applies to: 37-37

crates/prover-bin/src/zk_circuits_handler/universal.rs (1)

19-27: Confirm the segment_len bump aligns with resource budgets.

segment_len increased to (1 << 22) - 100, which can affect memory and throughput. Please confirm this is the intended target for the OpenVM 1.4.x prover configuration and fits downstream limits.

crates/prover-bin/src/prover.rs (2)

214-227: Panic propagation matches the “fail-fast” requirement.

Resuming unwind on task panic will terminate the worker as intended.


294-296: Verify OpenVM 1.3 tasks are intentionally hard-rejected.

use_openvm_13 now causes an immediate bail, and UniversalHandler::new no longer accepts the flag. Please confirm upstream won’t send OpenVM 1.3 tasks and that the error message is sufficient for operators.

Also applies to: 323-323

crates/prover-bin/src/dumper.rs (1)

54-87: Confirm Failed status is the intended dump-mode signal.

prove() and query_task() always return Failed to force exit. Please verify this matches the coordinator’s expectations (no retries/alerts for dump mode).

crates/libzkp/src/lib.rs (1)

24-37: Deprecation handling looks good.

The explicit warnings for legacy_witness and openvm_13 make misconfiguration visible while keeping behavior deterministic.

crates/prover-bin/src/main.rs (2)

1-6: New dumper module wiring looks fine.


36-51: TaskType → ProofType mapping is clear and complete.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Cargo.toml Outdated
Comment on lines 17 to 23
version = "4.7.11"

[workspace.dependencies]
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
# with openvm 1.4.2
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the Cargo.toml file to understand the context
cd $(git rev-parse --show-toplevel 2>/dev/null || pwd)
cat -n Cargo.toml | head -30

Repository: scroll-tech/scroll

Length of output: 1322


🏁 Script executed:

# Search for PR objectives, commit messages, or documentation mentioning OpenVM
rg -i "openvm.*1\.4\.[23]" --type-list

Repository: scroll-tech/scroll

Length of output: 451


🏁 Script executed:

# Check if there are any PR descriptions, README, or CHANGELOG files
fd -e md -e txt | grep -iE "(readme|changelog|pr|pull|objective)" | head -20

Repository: scroll-tech/scroll

Length of output: 272


🏁 Script executed:

# Look for any OpenVM version references in the entire repository
rg "openvm.*1\.4" -i

Repository: scroll-tech/scroll

Length of output: 6331


Update the OpenVM version comment from 1.4.2 to 1.4.3.

The Cargo.lock file shows OpenVM 1.4.3 is the actual dependency version, but the comment on line 20 references 1.4.2. Update the comment to reflect the correct version.

Suggested fix
-# with openvm 1.4.2
+# with openvm 1.4.3
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
version = "4.7.11"
[workspace.dependencies]
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
# with openvm 1.4.2
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
version = "4.7.11"
[workspace.dependencies]
# with openvm 1.4.3
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
🤖 Prompt for AI Agents
In `@Cargo.toml` around lines 17 - 23, Update the inline comment that currently
reads "with openvm 1.4.2" to "with openvm 1.4.3" in the Cargo.toml
workspace.dependencies block so the comment matches the actual OpenVM version
recorded in Cargo.lock; locate the comment near the
scroll-zkvm-prover/scroll-zkvm-verifier/scroll-zkvm-types entries and change
only the version number in that comment.

Comment on lines +13 to +16
pub struct Dumper {
#[allow(dead_code)]
pub target_path: String,
pub json_mode: bool,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Honor target_path when writing dump files.

dump() always writes to the current working directory, so a CLI-specified target_path is ignored. This makes the dump output location incorrect.

🐛 Proposed fix
     fn dump(&self, input_string: &str) -> eyre::Result<()> {
         let task: ProvingTaskExt = serde_json::from_str(input_string)?;
         let task = ProvingTask::from(task);
 
+        let base_dir = if self.target_path.is_empty() {
+            std::path::Path::new(".")
+        } else {
+            std::path::Path::new(&self.target_path)
+        };
+        std::fs::create_dir_all(base_dir)?;
+
         if self.json_mode {
-            let file = std::fs::File::create("input_task.json")?;
+            let file = std::fs::File::create(base_dir.join("input_task.json"))?;
             serde_json::to_writer(std::io::BufWriter::new(file), &task)?;
         } else {
             // stream-encode serialized_witness to input_task.bin using bincode 2.0
-            let input_file = std::fs::File::create("input_task.bin")?;
+            let input_file = std::fs::File::create(base_dir.join("input_task.bin"))?;
             let mut input_writer = std::io::BufWriter::new(input_file);
             bincode::encode_into_std_write(
                 &task.serialized_witness,
                 &mut input_writer,
                 bincode::config::standard(),
             )?;
 
             // stream-encode aggregated_proofs to agg_proofs.bin using bincode 2.0
-            let agg_file = std::fs::File::create("agg_proofs.bin")?;
+            let agg_file = std::fs::File::create(base_dir.join("agg_proofs.bin"))?;
             let mut agg_writer = std::io::BufWriter::new(agg_file);
             for proof in &task.aggregated_proofs {
                 let sz = bincode::serde::encode_into_std_write(
                     &proof.proofs,
                     &mut agg_writer,
                     bincode::config::standard(),
                 )?;
                 println!("written {sz} bytes for proof");
             }
         }

Also applies to: 24-39

🤖 Prompt for AI Agents
In `@crates/prover-bin/src/dumper.rs` around lines 13 - 16, The Dumper struct's
target_path is currently ignored by dump(); update the Dumper::dump (and any
related methods around lines 24-39) to use the Dumper.target_path when
creating/writing the output file: convert target_path to a Path/PathBuf, ensure
the parent directory exists (create_dir_all if needed), join the intended
filename to that path instead of using the current working directory, and
open/create the file at that joined path for writing; also preserve existing
json_mode logic and error handling when writing to the computed target path.

Comment on lines +60 to +61
#[arg(long = "json", default_value = "false")]
json_mode: bool,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's check the file at the specified lines
head -n 70 crates/prover-bin/src/main.rs | tail -n 20

Repository: scroll-tech/scroll

Length of output: 464


🏁 Script executed:

# Let's also check the Cargo.toml to see which clap version is being used
cat crates/prover-bin/Cargo.toml | grep -A5 clap

Repository: scroll-tech/scroll

Length of output: 255


🏁 Script executed:

# Let's look at more context around lines 60-61
sed -n '50,75p' crates/prover-bin/src/main.rs

Repository: scroll-tech/scroll

Length of output: 552


🏁 Script executed:

# Let's check if there are other bool flags in the codebase and how they're defined
rg -B2 "bool," crates/prover-bin/src/main.rs | head -40

Repository: scroll-tech/scroll

Length of output: 258


🏁 Script executed:

# Let's check if ArgAction is used elsewhere in the codebase
rg "ArgAction" crates/ --type rust

Repository: scroll-tech/scroll

Length of output: 228


🏁 Script executed:

# Let's search for other #[arg] attributes to understand the pattern
rg "#\[arg\(" crates/prover-bin/src/main.rs -A1 -B1

Repository: scroll-tech/scroll

Length of output: 528


Use action = ArgAction::SetTrue for flag-style parsing of --json.

With default_value = "false", clap 4.5 expects --json true|false. Since version in the same file uses ArgAction::SetTrue for flag-style behavior, apply the same pattern here.

🔧 Suggested change
-        #[arg(long = "json", default_value = "false")]
+        #[arg(long = "json", action = ArgAction::SetTrue)]
         json_mode: bool,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[arg(long = "json", default_value = "false")]
json_mode: bool,
#[arg(long = "json", action = ArgAction::SetTrue)]
json_mode: bool,
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/main.rs` around lines 60 - 61, Change the clap argument
for the json flag to use flag-style parsing by replacing the current
default_value usage with action = ArgAction::SetTrue for the json_mode field;
locate the json_mode field declaration in main.rs (the #[arg(long = "json",
default_value = "false")] json_mode: bool,) and update it to use #[arg(long =
"json", action = ArgAction::SetTrue)] json_mode: bool, and ensure ArgAction is
in scope (same pattern used by the version flag in this file).

Comment on lines +95 to +108
let prover = ProverBuilder::new(
sdk_config,
dumper::Dumper {
json_mode,
..Default::default()
},
)
.build()
.await
.map_err(|e| eyre::eyre!("build prover fail: {e}"))?;

std::sync::Arc::new(prover)
.one_shot(&[task_id], task_type.into())
.await;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the specific file and lines mentioned
head -120 crates/prover-bin/src/main.rs | tail -40

Repository: scroll-tech/scroll

Length of output: 1372


🏁 Script executed:

# Now let's find where one_shot is defined
rg "fn one_shot" --type rust -A 5

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Let's also search for the return type more broadly
rg "one_shot" crates/prover-bin/src/main.rs -B 2 -A 10

Repository: scroll-tech/scroll

Length of output: 1455


🏁 Script executed:

# Search for one_shot method definition
fd "\.rs$" crates/ | xargs rg "fn one_shot" -B 2 -A 8

Repository: scroll-tech/scroll

Length of output: 46


🏁 Script executed:

# Also search in the prover crate
find . -name "*.rs" -type f | xargs rg "fn one_shot" -B 2 -A 8 | head -50

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Try to find the type definition by looking for impl blocks or traits
rg "impl.*one_shot|trait.*Prover" -B 2 -A 10 | head -100

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Check what ProverBuilder builds to understand the prover type
rg "ProverBuilder" crates/prover-bin/src/main.rs -B 5 -A 15 | head -80

Repository: scroll-tech/scroll

Length of output: 2387


🏁 Script executed:

# Let's look at the scroll_proving_sdk crate to find the one_shot definition
find . -path "*/scroll_proving_sdk/*" -name "*.rs" | head -20

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Check for prover definitions in the prover crate
find . -path "*/prover/*" -name "*.rs" -type f | head -30

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# List the crates directory to understand the structure
ls -la crates/ | head -30

Repository: scroll-tech/scroll

Length of output: 402


🏁 Script executed:

# Search for one_shot across all rust files more broadly
rg "fn one_shot" . --type rust

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Try to find where ProverBuilder is defined
rg "pub.*struct ProverBuilder|impl ProverBuilder" . --type rust -A 3

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Check the Cargo.toml in prover-bin to see where ProverBuilder comes from
cat crates/prover-bin/Cargo.toml

Repository: scroll-tech/scroll

Length of output: 1152


🏁 Script executed:

# Look at the entire repository structure to find scroll_proving_sdk
find . -name "*proving*" -o -name "*prover*" | grep -E "(\.rs$|\.toml$)" | head -30

Repository: scroll-tech/scroll

Length of output: 95


🏁 Script executed:

# Search for scroll_proving_sdk in git ls-files
git ls-files | grep -E "scroll_proving_sdk|prover" | head -50

Repository: scroll-tech/scroll

Length of output: 2303


🏁 Script executed:

# Let's check the prover.rs file in prover-bin to see how one_shot is used there
cat crates/prover-bin/src/prover.rs

Repository: scroll-tech/scroll

Length of output: 12441


🏁 Script executed:

# Check imports and see if there are any type hints about one_shot
head -50 crates/prover-bin/src/main.rs

Repository: scroll-tech/scroll

Length of output: 1262


Handle one_shot failures instead of ignoring the result.

The Dump command path ignores the return value of one_shot, while the Handle command path explicitly asserts on the result (indicating a bool return). This inconsistency means dump failures silently succeed. Check the return value and propagate the error to the CLI.

🔧 Suggested change
-            std::sync::Arc::new(prover)
-                .one_shot(&[task_id], task_type.into())
-                .await;
+            let success = std::sync::Arc::new(prover)
+                .one_shot(&[task_id], task_type.into())
+                .await;
+            if !success {
+                eyre::bail!("dump failed for task_id={task_id}");
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let prover = ProverBuilder::new(
sdk_config,
dumper::Dumper {
json_mode,
..Default::default()
},
)
.build()
.await
.map_err(|e| eyre::eyre!("build prover fail: {e}"))?;
std::sync::Arc::new(prover)
.one_shot(&[task_id], task_type.into())
.await;
let prover = ProverBuilder::new(
sdk_config,
dumper::Dumper {
json_mode,
..Default::default()
},
)
.build()
.await
.map_err(|e| eyre::eyre!("build prover fail: {e}"))?;
let success = std::sync::Arc::new(prover)
.one_shot(&[task_id], task_type.into())
.await;
if !success {
eyre::bail!("dump failed for task_id={task_id}");
}
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/main.rs` around lines 95 - 108, The Dump command
currently calls ProverBuilder::new(...).build().await and then ignores the
boolean/result of Arc::new(prover).one_shot(&[task_id], task_type.into()).await;
modify the Dump command path to check the returned Result/bool from one_shot
(same as the Handle path does), and if it indicates failure return or propagate
an error to the CLI (e.g., map_err/eyre::eyre! or bail). Locate the call site
for one_shot in main.rs and ensure you mirror the Handle flow: inspect the
awaited value, convert it to a useful error on failure, and propagate it up
instead of discarding it.

@noel2004 noel2004 mentioned this pull request Feb 20, 2026
@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.42%. Comparing base (efca370) to head (649c441).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
rollup/tests/integration_tool/imports.go 0.00% 8 Missing ⚠️
coordinator/internal/utils/version.go 0.00% 5 Missing ⚠️
rollup/cmd/rollup_relayer/app/app.go 0.00% 3 Missing ⚠️
coordinator/internal/utils/codec_validium.go 0.00% 1 Missing ⚠️
rollup/internal/controller/relayer/l2_relayer.go 0.00% 1 Missing ⚠️
rollup/internal/utils/utils.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1783      +/-   ##
===========================================
- Coverage    36.47%   36.42%   -0.06%     
===========================================
  Files          248      248              
  Lines        21329    21320       -9     
===========================================
- Hits          7780     7765      -15     
- Misses       12720    12732      +12     
+ Partials       829      823       -6     
Flag Coverage Δ
common 29.45% <ø> (ø)
database 42.05% <ø> (ø)
rollup 35.15% <0.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rollup/tests/integration_tool/imports.go (1)

161-163: ⚠️ Potential issue | 🟡 Minor

Clarify the l1MsgPoppedBefore == 0 log message.

Line 162 says “no l1 message in target blks”, but this branch is also taken when the first L1 nonce is 0 (message exists). The log is misleading during debugging.

Proposed fix
-	log.Info("no l1 message in target blks, no need for leading chunk")
+	log.Info("first l1 nonce is 0 or no l1 message found; no need for leading chunk")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rollup/tests/integration_tool/imports.go` around lines 161 - 163, The log
message for the branch guarded by l1MsgPoppedBefore == 0 is misleading because
that condition can be true either when there are genuinely no L1 messages in the
target blocks or when the first L1 nonce is 0; update the message in the same
block (where l1MsgPoppedBefore is checked) to clarify which case occurred by
adding context—e.g., indicate whether the target blocks contain no L1 messages
or whether the first L1 nonce is zero (or include the value of
l1MsgPoppedBefore) so debugging can distinguish the two situations; modify the
log.Info call referencing l1MsgPoppedBefore accordingly.
🧹 Nitpick comments (2)
coordinator/internal/utils/version.go (1)

22-27: Please add table-driven tests for this new Validium branch.

Given the changed behavior and current patch coverage gap, add cases for galileov2 (success), non-supported forks (error), and mixed-case input normalization to lock this behavior down.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@coordinator/internal/utils/version.go` around lines 22 - 27, Add table-driven
unit tests targeting the new Validium branch in version.go that exercises the
switch on canonicalName (strings.ToLower(hardForkName)): include a case where
hardForkName == "galileov2" (expect stfVersion == 1 and nil error), a case with
an unsupported fork name (expect non-nil error containing "unsupported fork in
validium mode" and zero version), and a mixed-case input (e.g., "GaLiLeOv2") to
verify normalization via strings.ToLower; implement these as subtests in a
single TestValidiumForks function using a slice of test cases and assertions
against the returned stfVersion and error from the function that contains the
switch (referencing canonicalName/hardForkName/stfVersion in version.go).
rollup/tests/integration_tool/imports.go (1)

149-159: Add branch coverage for the two zero-return paths.

Please add targeted tests for: (1) no L1 message in scanned blocks, and (2) first L1 message nonce equals 0. This refactor centralizes behavior, so explicit coverage will prevent regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rollup/tests/integration_tool/imports.go` around lines 149 - 159, Add two
unit tests targeting the zero-return branches of the l1MsgPoppedBefore closure:
(1) construct a blks slice with transactions but no tx.Type ==
types.L1MessageTxType and assert l1MsgPoppedBefore returns 0, and (2) construct
blks where the first encountered L1 message has tx.Nonce == 0 and assert
l1MsgPoppedBefore returns 0. Locate the closure called l1MsgPoppedBefore in
imports.go and reuse the same surrounding setup (beginBlk, blks, Transactions)
so the new tests exercise the exact code path; assert the returned uint64 equals
0 for both cases to provide explicit branch coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rollup/cmd/rollup_relayer/app/app.go`:
- Around line 114-116: Add unit/regression tests that exercise the new Validium
branch that checks cfg.L2Config.RelayerConfig.ValidiumMode against
minCodecVersion and encoding.CodecV10: one test where ValidiumMode=true and
minCodecVersion < encoding.CodecV10 that asserts the code path fails (e.g.,
expects log.Crit or the function to return an error/exit) and another where
ValidiumMode=true and minCodecVersion >= encoding.CodecV10 that asserts the code
path proceeds successfully. Locate the check in
rollup/cmd/rollup_relayer/app/app.go (the if using
cfg.L2Config.RelayerConfig.ValidiumMode and minCodecVersion) and add tests
(e.g., TestValidiumMinCodecVersion_Fails and TestValidiumMinCodecVersion_Passes)
that construct cfg with different minCodecVersion values and verify the
failure/success behavior.

In `@tests/prover-e2e/cloak-galileoV2/config.json`:
- Line 4: The config.json contains an inline DSN with credentials in the "dsn"
key which must be removed; replace the hard-coded value with a placeholder or
env reference (e.g. set "dsn" to a sentinel like "__ENV_DSN__" or empty) and
update the test/runtime bootstrap to read the actual connection string from an
environment variable (e.g. CLOAK_GALILEOV2_DSN) before starting tests; ensure
the change is made where "dsn" is defined in config.json and that the test
harness or setup code that creates the DB connection (the code that consumes
config.json's "dsn") is updated to throw a clear error if the env var is missing
so CI/local runs must inject the DSN securely.

---

Outside diff comments:
In `@rollup/tests/integration_tool/imports.go`:
- Around line 161-163: The log message for the branch guarded by
l1MsgPoppedBefore == 0 is misleading because that condition can be true either
when there are genuinely no L1 messages in the target blocks or when the first
L1 nonce is 0; update the message in the same block (where l1MsgPoppedBefore is
checked) to clarify which case occurred by adding context—e.g., indicate whether
the target blocks contain no L1 messages or whether the first L1 nonce is zero
(or include the value of l1MsgPoppedBefore) so debugging can distinguish the two
situations; modify the log.Info call referencing l1MsgPoppedBefore accordingly.

---

Nitpick comments:
In `@coordinator/internal/utils/version.go`:
- Around line 22-27: Add table-driven unit tests targeting the new Validium
branch in version.go that exercises the switch on canonicalName
(strings.ToLower(hardForkName)): include a case where hardForkName ==
"galileov2" (expect stfVersion == 1 and nil error), a case with an unsupported
fork name (expect non-nil error containing "unsupported fork in validium mode"
and zero version), and a mixed-case input (e.g., "GaLiLeOv2") to verify
normalization via strings.ToLower; implement these as subtests in a single
TestValidiumForks function using a slice of test cases and assertions against
the returned stfVersion and error from the function that contains the switch
(referencing canonicalName/hardForkName/stfVersion in version.go).

In `@rollup/tests/integration_tool/imports.go`:
- Around line 149-159: Add two unit tests targeting the zero-return branches of
the l1MsgPoppedBefore closure: (1) construct a blks slice with transactions but
no tx.Type == types.L1MessageTxType and assert l1MsgPoppedBefore returns 0, and
(2) construct blks where the first encountered L1 message has tx.Nonce == 0 and
assert l1MsgPoppedBefore returns 0. Locate the closure called l1MsgPoppedBefore
in imports.go and reuse the same surrounding setup (beginBlk, blks,
Transactions) so the new tests exercise the exact code path; assert the returned
uint64 equals 0 for both cases to provide explicit branch coverage.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a57a2e and 649c441.

⛔ Files ignored due to path filters (7)
  • Cargo.lock is excluded by !**/*.lock
  • bridge-history-api/go.sum is excluded by !**/*.sum
  • common/go.sum is excluded by !**/*.sum
  • coordinator/go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • rollup/go.sum is excluded by !**/*.sum
  • tests/integration-test/go.sum is excluded by !**/*.sum
📒 Files selected for processing (24)
  • Cargo.toml
  • bridge-history-api/go.mod
  • common/go.mod
  • common/version/version.go
  • coordinator/go.mod
  • coordinator/internal/utils/codec_validium.go
  • coordinator/internal/utils/version.go
  • rollup/cmd/rollup_relayer/app/app.go
  • rollup/go.mod
  • rollup/internal/controller/relayer/l2_relayer.go
  • rollup/internal/utils/utils.go
  • rollup/tests/integration_tool/imports.go
  • tests/integration-test/go.mod
  • tests/prover-e2e/Makefile
  • tests/prover-e2e/cloak-galileoV2/.make.env
  • tests/prover-e2e/cloak-galileoV2/config.json
  • tests/prover-e2e/cloak-galileoV2/config.template.json
  • tests/prover-e2e/cloak-galileoV2/genesis.json
  • tests/prover-e2e/cloak-xen/.make.env
  • tests/prover-e2e/cloak-xen/00100_import_blocks.sql
  • tests/prover-e2e/cloak-xen/config.json
  • tests/prover-e2e/mainnet-galileo/.make.env
  • tests/prover-e2e/sepolia-galileo/.make.env
  • tests/prover-e2e/sepolia-galileoV2/.make.env
💤 Files with no reviewable changes (2)
  • tests/prover-e2e/cloak-xen/config.json
  • tests/prover-e2e/cloak-xen/.make.env
✅ Files skipped from review due to trivial changes (3)
  • common/version/version.go
  • rollup/internal/controller/relayer/l2_relayer.go
  • tests/prover-e2e/sepolia-galileoV2/.make.env
🚧 Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • tests/prover-e2e/mainnet-galileo/.make.env

Comment on lines +114 to +116
if cfg.L2Config.RelayerConfig.ValidiumMode && minCodecVersion < encoding.CodecV10 {
log.Crit("min codec version must be greater than or equal to CodecV10 in validium mode", "minCodecVersion", minCodecVersion)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add regression tests for the new Validium branch.

Line 114 introduces a new fail-fast path, but this branch is currently uncovered in the patch report. Please add coverage for both cases: ValidiumMode=true with < CodecV10 (fails) and >= CodecV10 (passes).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rollup/cmd/rollup_relayer/app/app.go` around lines 114 - 116, Add
unit/regression tests that exercise the new Validium branch that checks
cfg.L2Config.RelayerConfig.ValidiumMode against minCodecVersion and
encoding.CodecV10: one test where ValidiumMode=true and minCodecVersion <
encoding.CodecV10 that asserts the code path fails (e.g., expects log.Crit or
the function to return an error/exit) and another where ValidiumMode=true and
minCodecVersion >= encoding.CodecV10 that asserts the code path proceeds
successfully. Locate the check in rollup/cmd/rollup_relayer/app/app.go (the if
using cfg.L2Config.RelayerConfig.ValidiumMode and minCodecVersion) and add tests
(e.g., TestValidiumMinCodecVersion_Fails and TestValidiumMinCodecVersion_Passes)
that construct cfg with different minCodecVersion values and verify the
failure/success behavior.

{
"db_config": {
"driver_name": "postgres",
"dsn": "postgres://dev:dev@localhost:5432/scroll?sslmode=disable",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid committing DSNs with inline credentials in tracked config.

Line 4 embeds username/password directly. Even test credentials tend to create secret-scanner noise and accidental reuse risk; prefer injecting the DSN via environment/runtime config.

🔧 Suggested change
-    "dsn": "postgres://dev:dev@localhost:5432/scroll?sslmode=disable",
+    "dsn": "${SCROLL_PROVER_E2E_DSN}",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dsn": "postgres://dev:dev@localhost:5432/scroll?sslmode=disable",
"dsn": "${SCROLL_PROVER_E2E_DSN}",
🧰 Tools
🪛 Checkov (3.2.334)

[medium] 4-5: Basic Auth Credentials

(CKV_SECRET_4)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/prover-e2e/cloak-galileoV2/config.json` at line 4, The config.json
contains an inline DSN with credentials in the "dsn" key which must be removed;
replace the hard-coded value with a placeholder or env reference (e.g. set "dsn"
to a sentinel like "__ENV_DSN__" or empty) and update the test/runtime bootstrap
to read the actual connection string from an environment variable (e.g.
CLOAK_GALILEOV2_DSN) before starting tests; ensure the change is made where
"dsn" is defined in config.json and that the test harness or setup code that
creates the DB connection (the code that consumes config.json's "dsn") is
updated to throw a clear error if the env var is missing so CI/local runs must
inject the DSN securely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants